﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using XT.Model;
using XT.BusinessService;

namespace XT.Web.ApiControllers
{
    public class CityController : ApiController
    {
        private object GetResponse(City c)
        {
            return new
            {
                Id = c.Id,
                Name = c.City_Name,
                Location = c.City_Location,
            };
        }

        public IEnumerable<Object> GetAllCity()
        {
            var cityService = MvcApplication.GetInstance<ICityService>();
            var list = cityService.GetCitys();
            return list.Select(GetResponse);
        }
    }
}